Picture Level Adaptive Frame/Field Coding for Digital Video Content

ABSTRACT

A method and system of encoding and decoding digital video content. The digital video content comprises a stream of pictures which can each be intra, predicted, or bi-predicted pictures. Each of the pictures comprises macroblocks that can be further divided into smaller blocks. The method entails encoding and decoding each picture in said stream of pictures in either frame mode or in field mode.

TECHNICAL FIELD

The present invention relates to encoding and decoding of digital video content. More specifically, the present invention relates to frame mode and field mode encoding and decoding of digital video content at the picture level as used in the MPEG-4 Part 10 AVC/H.264 video coding standard.

BACKGROUND

Video compression is used in many current and emerging products. It is at the heart of digital television set-top boxes (STBs), digital satellite systems (DSSs), high definition television (HDTV) decoders, digital versatile disk (DVD) players, video conferencing, Internet video and multimedia content, and other digital video applications. Without video compression, digital video content can be extremely large, making it difficult or even impossible for the digital video content to be efficiently stored, transmitted, or viewed.

The digital video content comprises a stream of pictures that can be displayed as an image on a television receiver, computer monitor, or some other electronic device capable of displaying digital video content. A picture that is displayed in time before a particular picture is in the “backward direction” in relation to the particular picture. Likewise, a picture that is displayed in time after a particular picture is in the “forward direction” in relation to the particular picture.

Video compression is accomplished in a video encoding, or coding, process in which each picture is encoded as either a frame or as two fields. Each frame comprises a number of lines of spatial information. For example, a typical frame contains 480 horizontal lines. Each field contains half the number of lines in the frame. For example, if the frame comprises 480 horizontal lines, each field comprises 240 horizontal lines. In a typical configuration, one of the fields comprises the odd numbered lines in the frame and the other field comprises the even numbered lines in the frame. The field that comprises the odd numbered lines will be referred to as the “top” field hereafter and in the appended claims, unless otherwise specifically denoted. Likewise, the field that comprises the even numbered lines will be referred to as the “bottom” field hereafter and in the appended claims, unless otherwise specifically denoted. The two fields can be interlaced together to form an interlaced frame.

The general idea behind video coding is to remove data from the digital video content that is “non-essential.” The decreased amount of data then requires less bandwidth for broadcast or transmission. After the compressed video data has been transmitted, it must be decoded, or decompressed. In this process, the transmitted video data is processed to generate approximation data that is substituted into the video data to replace the “non-essential” data that was removed in the coding process.

Video coding transforms the digital video content into a compressed form that can be stored using less space and transmitted using less bandwidth than uncompressed digital video content. It does so by taking advantage of temporal and spatial redundancies in the pictures of the video content. The digital video content can be stored in a storage medium such as a hard drive, DVD, or some other non-volatile storage unit.

There are numerous video coding methods that compress the digital video content. Consequently, video coding standards have been developed to standardize the various video coding methods so that the compressed digital video content is rendered in formats that a majority of video encoders and decoders can recognize. For example, the Motion Picture Experts Group (MPEG) and International Telecommunication Union (ITU-T) have developed video coding standards that are in wide use. Examples of these standards include the MPEG-1, MPEG-2, MPEG-4, ITU-T H261, and ITU-T H263 standards.

Most modern video coding standards, such as those developed by MPEG and ITU-T, are based in part on a temporal prediction with motion compensation (MC) algorithm. Temporal prediction with motion compensation is used to remove temporal redundancy between successive pictures in a digital video broadcast.

The temporal prediction with motion compensation algorithm typically utilizes one or two reference pictures to encode a particular picture. A reference picture is a picture that has already been encoded. By comparing the particular picture that is to be encoded with one of the reference pictures, the temporal prediction with motion compensation algorithm can take advantage of the temporal redundancy that exists between the reference picture and the particular picture that is to be encoded and encode the picture with a higher amount of compression than if the picture were encoded without using the temporal prediction with motion compensation algorithm. One of the reference pictures may be in the backward direction in relation to the particular picture that is to be encoded. The other reference picture is in the forward direction in relation to the particular picture that is to be encoded.

However, as the demand for higher resolutions, more complex graphical content, and faster transmission time increases, so does the need for better video compression methods. To this end, a new video coding standard is currently being developed. This new video coding standard is called the MPEG-4 Part 10 AVC/H.264 standard.

The new MPEG-4 Part 10 AVC/H.264 standard calls for a number of new methods in video compression. For example, one of the features of the new MPEG-4 Part 10 AVC/H.264 standard is that it allows multiple reference pictures, instead of just two reference pictures. The use of multiple reference pictures improves the performance of the temporal prediction with motion compensation algorithm by allowing the encoder to find the reference picture that most closely matches the picture that is to be encoded. By using the reference picture in the coding process that most closely matches the picture that is to be encoded, the greatest amount of compression is possible in the encoding of the picture. The reference pictures are stored in frame and field buffers.

As previously stated, the encoder can encode a picture as a frame or as two fields. A greater degree of compression could be accomplished if, in a sequence of pictures that is to be encoded, some of the pictures are encoded as frames and some of the pictures are encoded as fields.

SUMMARY OF THE INVENTION

In one of many possible embodiments, the present invention provides a method of encoding, decoding, and bitstream generation of digital video content. The digital video content comprises a stream of pictures which can each be intra, predicted, or bi-predicted pictures. Each of the pictures comprises macroblocks that can be further divided into smaller blocks. The method entails encoding and decoding each picture in said stream of pictures in either frame mode or in field mode.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings illustrate various embodiments of the present invention and are a part of the specification. Together with the following description, the drawings demonstrate and explain the principles of the present invention. The illustrated embodiments are examples of the present invention and do not limit the scope of the invention.

FIG. 1 illustrates an exemplary sequence of three types of pictures that can be used to implement the present invention, as defined by an exemplary video coding standard such as the MPEG-4 Part 10 AVC/H.264 standard.

FIG. 2 shows that each picture is preferably divided into slices containing macroblocks according to an embodiment of the present invention.

FIG. 3 a shows that a macroblock can be further divided into a block size of 16 by 8 pixels according to an embodiment of the present invention.

FIG. 3 b shows that a macroblock can be further divided into a block size of 8 by 16 pixels according to an embodiment of the present invention.

FIG. 3 c shows that a macroblock can be further divided into a block size of 8 by 8 pixels according to an embodiment of the present invention.

FIG. 3 d shows that a macroblock can be further divided into a block size of 8 by 4 pixels according to an embodiment of the present invention.

FIG. 3 e shows that a macroblock can be further divided into a block size of 4 by 8 pixels according to an embodiment of the present invention.

FIG. 3 f shows that a macroblock can be further divided into a block size of 4 by 4 pixels according to an embodiment of the present invention.

FIG. 4 shows a picture construction example using temporal prediction with motion compensation that illustrates an embodiment of the present invention.

FIG. 5 shows an exemplary stream of pictures which illustrates an advantage of using multiple reference pictures in temporal prediction with motion compensation according to an embodiment of the present invention.

FIG. 6 illustrates according to an embodiment of the present invention that a unique reference frame number is assigned to each reference frame in the frame buffer according to its distance from the current picture that is being encoded in frame mode.

FIG. 7 a shows an exemplary reference field numbering configuration where the reference fields of the same field parity as the current field are given smaller numbers than are their corresponding second fields according to an embodiment of the present invention.

FIG. 7 b shows an exemplary reference field numbering configuration where the current field is the second field of the picture that is to be encoded as two fields.

FIG. 8 shows an alternate reference field numbering configuration in the field buffer according to an embodiment of the present invention.

FIG. 9 illustrates a method of direct mode vector calculation where both the current macroblock and its co-located macroblock are in frame mode.

FIG. 10 illustrates a method of direct mode vector calculation where both the current macroblock and its co-located macroblock are in field mode.

FIG. 11 illustrates another method of direct mode vector calculation where both the current macroblock and its co-located macroblock are in field mode.

FIG. 12 illustrates a method of direct mode vector calculation where the current macroblock is in field mode and its co-located macroblock is in frame mode.

FIG. 13 illustrates a method of direct mode vector calculation where the current macroblock is in frame mode and its co-located macroblock is in field mode.

FIG. 14 shows a B picture with its two reference pictures in the temporal forward direction according to an embodiment of the present invention.

FIG. 15 shows a B picture with its two reference pictures in the temporal backward direction according to an embodiment of the present invention.

FIG. 16 shows a B picture with a forward reference picture in the temporal forward direction and a backward reference picture in the temporal backward direction.

Throughout the drawings, identical reference numbers designate similar, but not necessarily identical, elements.

DETAILED DESCRIPTION OF EMBODIMENTS OF THE INVENTION

The present invention provides a method of adaptive frame/field (AFF) coding of digital video content comprising a stream of pictures at a picture level. In AFF coding at a picture level, each picture in a stream of pictures that is to be encoded is encoded in either frame mode or in field mode, regardless of the other picture's frame or field coding mode. If a picture is encoded in frame mode, the two fields that make up an interlaced frame are coded jointly. Conversely, if a picture is encoded in field mode, the two fields that make up an interlaced frame are coded separately. The encoder determines which type of coding, frame mode coding or field mode coding, is more advantageous for each picture and chooses that type of encoding for the picture. The exact method of choosing between frame mode and field mode is not critical to the present invention and will not be detailed herein.

As noted above, the MPEG-4 Part 10 AVC/H.264 standard is a new standard for encoding and compressing digital video content. The documents establishing the MPEG-4 Part 10 AVC/H.264 standard are hereby incorporated by reference, including “Joint Final Committee Draft (JFCD) of Joint Video Specification” issued by the Joint Video Team (JVT) on Aug. 10, 2002. (ITU-T Rec. H.264 & ISO/IEC 14496-10 AVC). The JVT consists of experts from ISO or MPEG and ITU-T. Due to the public nature of the MPEG-4 Part 10 AVC/H.264 standard, the present specification will not attempt to document all the existing aspects of MPEG-4 Part 10 AVC/H.264 video coding, relying instead on the incorporated specifications of the standard.

Although this method of AFF encoding is compatible with and will be explained using the MPEG-4 Part 10 AVC/H.264 standard guidelines, it can be modified and used as best serves a particular standard or application.

Using the drawings, the preferred embodiments of the present invention will now be explained.

FIG. 1 illustrates an exemplary sequence of three types of pictures that can be used to implement the present invention, as defined by an exemplary video coding standard such as the MPEG-4 Part 10 AVC/H.264 standard. As previously mentioned, the encoder encodes the pictures and the decoder decodes the pictures. The encoder or decoder can be a processor, application specific integrated circuit (ASIC), field programmable gate array (FPGA), coder/decoder (CODEC), digital signal processor (DSP), or some other electronic device that is capable of encoding the stream of pictures. However, as used hereafter and in the appended claims, unless otherwise specifically denoted, the term “encoder” will be used to refer expansively to all electronic devices that encode digital video content comprising a stream of pictures. Also, as used hereafter and in the appended claims, unless otherwise specifically denoted, the term “decoder” will be used to refer expansively to all electronic devices that decode digital video content comprising a stream of pictures.

As shown in FIG. 1, there are preferably three types of pictures that can be used in the video coding method. Three types of pictures are defined to support random access to stored digital video content while exploring the maximum redundancy reduction using temporal prediction with motion compensation. The three types of pictures are intra (I) pictures (100), predicted (P) pictures (102 a,b), and bi-predicted (B) pictures (101 a-d). An I picture (100) provides an access point for random access to stored digital video content and can be encoded only with slight compression. Intra pictures (100) are encoded without referring to reference pictures.

A predicted picture (102 a,b) is encoded using an I, P, or B picture that has already been encoded as a reference picture. The reference picture can be in either the forward or backward temporal direction in relation to the P picture that is being encoded. The predicted pictures (102 a,b) can be encoded with more compression than the intra pictures (100).

A bi-predicted picture (101 a-d) is encoded using two temporal reference pictures: a forward reference picture and a backward reference picture. The forward reference picture is sometimes called the past reference picture and the backward reference picture is sometimes called a future reference picture. An embodiment of the present invention is that the forward reference picture and backward reference picture can be in the same temporal direction in relation to the B picture that is being encoded. Bi-predicted pictures (101 a-d) can be encoded with the most compression out of the three picture types.

Reference relationships (103) between the three picture types are illustrated in FIG. 1. For example, the P picture (102 a) can be encoded using the encoded I picture (100) as its reference picture. The B pictures (101 a-d) can be encoded using the encoded I picture (100) or the encoded P picture (102 a) as its reference pictures, as shown in FIG. 1. Under the principles of an embodiment of the present invention, encoded B pictures (101 a-d) can also be used as reference pictures for other B pictures that are to be encoded. For example, the B picture (101 c) of FIG. 1 is shown with two other B pictures (101 b and 101 d) as its reference pictures.

The number and particular order of the I (100), B (101 a-d), and P (102 a,b) pictures shown in FIG. 1 are given as an exemplary configuration of pictures, but are not necessary to implement the present invention. Any number of I, B, and P pictures can be used in any order to best serve a particular application. The MPEG-4 Part 10 AVC/H.264 standard does not impose any limit to the number of B pictures between two reference pictures nor does it limit the number of pictures between two I pictures.

FIG. 2 shows that each picture (200) is preferably divided into slices (202). A slice (202) contains a group of macroblocks (202). A macroblock (201) is a rectangular group of pixels. As shown in FIG. 2, a preferable macroblock (201) size is 16 by 16 pixels.

FIGS. 3 a-f show that a macroblock can be further divided into smaller sized blocks. For example, as shown in FIGS. 3 a-f, a macroblock can be further divided into block sizes of 16 by 8 pixels (FIG. 3 a; 300), 8 by 16 pixels (FIG. 3 b; 301), 8 by 8 pixels (FIG. 3 c; 302), 8 by 4 pixels (FIG. 3 d; 303), 4 by 8 pixels (FIG. 3 e; 304), or 4 by 4 pixels (FIG. 3 f; 305).

FIG. 4 shows a picture construction example using temporal prediction with motion compensation that illustrates an embodiment of the present invention. Temporal prediction with motion compensation assumes that a current picture, picture N (400), can be locally modeled as a translation of another picture, picture N-1 (401). The picture N-1 (401) is the reference picture for the encoding of picture N (400) and can be in the forward or backwards temporal direction in relation to picture N (400).

As shown in FIG. 4, each picture is preferably divided into slices containing macroblocks (201 a,b). The picture N-1 (401) contains an image (403) that is to be shown in picture N (400). The image (403) will be in a different temporal position (402) in picture N (400) than it is in picture N-1 (401), as shown in FIG. 4. The image content of each macroblock (201 b) of picture N (400) is predicted from the image content of each corresponding macroblock (201 a) of picture N-1 (401) by estimating the required amount of temporal motion of the image content of each macroblock (201 a) of picture N-1 (401) for the image (403) to move to its new temporal position (402) in picture N (400). Instead of the original image (402), the difference (404) between the image (402) and its prediction (403) is actually encoded and transmitted.

For each image (402) in picture N (400), the temporal prediction can often be represented by motion vectors that represent the amount of temporal motion required for the image (403) to move to a new temporal position (402) in the picture N (400). The motion vectors (406) used for the temporal prediction with motion compensation need to be encoded and transmitted.

FIG. 4 shows that the image (402) in picture N (400) can be represented by the difference (404) between the image and its prediction and the associated motion vectors (406). The exact method of encoding using the motion vectors can vary as best serves a particular application and can be easily implemented by someone who is skilled in the art.

FIG. 5 shows an exemplary stream of pictures which illustrates an advantage of using multiple reference pictures in temporal prediction with motion compensation according to an embodiment of the present invention. The use of multiple reference pictures increases the likelihood that the picture N (400) to be encoded with the most compression possible. Pictures N-1 (401), N-2 (500), and N-3 (501) have been already encoded in this example. As shown in FIG. 5, an image (504) in picture N-3 (501) is more similar to the image (402) in picture N (400) than are the images (503, 502) of pictures N-2 (500) and N-1 (401), respectively. The use of multiple reference pictures allows picture N (400) to be encoded using picture N-3 (501) as its reference picture instead of picture N-1 (401).

Picture level AFF coding of a stream of pictures will now be explained in more detail. A frame of an interlaced sequence contains two fields, the top field and the bottom field, which are interleaved and separated in time by a field period. The field period is half the time of a frame period. In picture level AFF coding, the two fields of an interlaced frame can be coded jointly or separately. If they are coded jointly, frame mode coding is used. Conversely, if the two fields are coded separately, field mode coding is used.

Fixed frame/field coding, on the other hand, codes all the pictures in a stream of pictures in one mode only. That mode can be frame mode or it can be field mode. Picture level AFF is preferable to fixed frame/field coding because it allows the encoder to choose which mode, frame mode or field mode, to encode each picture in the stream of pictures based on the contents of the digital video material.

Frame mode coding uses pictures that have already been encoded as frames as reference frames. The reference frames can be any coded I, P, or B frame. The reference frames are stored in a frame buffer, which is part of the encoder. An embodiment of the present invention is that a unique reference frame number is assigned to each reference frame in the frame buffer according to its distance from the current picture that is being encoded in frame mode, as shown in the exemplary configuration of FIG. 6. For example, as shown in FIG. 6, a current picture that is to be encoded as a frame (600) has a number of reference frames (0-5) in the frame buffer (601). Also shown in FIG. 6 are the corresponding fields (f1, f2) to the current frame (600) and the reference frames (0-5). The dotted lines labeled f1 are first fields and the dotted lines labeled f2 are second fields. A first field is the first field that is encoded in a picture of two fields. Likewise, a second field is the second field that is encoded in a picture of two fields. An embodiment of the present invention is that the first field can be either the top or bottom field. In another embodiment of the present invention, the second field can also be either the top or bottom field. The frames are represented by solid lines. As shown in FIG. 6, the reference frame 0 is temporally the closest reference frame to the current frame (600). The reference frame number increases the further the reference frame is temporally from the current frame (600).

Under principles of an embodiment of the present invention, a B picture that is encoded as a frame can have multiple forward and backward reference pictures. Unique numbers are assigned to the forward and backward reference pictures.

In the temporal prediction with motion compensation algorithm, sub-pel interpolation is performed on each of the pixels in a picture that is encoded as a frame. Padding can also be applied to reference pictures encoded as frames by repeating the pixels on the frame boundaries. Padding is sometimes desirable in the temporal prediction with motion compensation algorithm. Loop filtering, or de-blocking schemes, can be applied to frame blocks to account for pixel value discontinuities at the edges of adjacent blocks.

According to another embodiment of the present invention, a macroblock in a P picture can be skipped in AFF coding. If a macroblock is skipped, its data is not transmitted in the encoding of the picture. A skipped macroblock in a P picture is reconstructed by copying the co-located macroblock with motion compensation in the most recently coded I or P reference picture that has been encoded as a frame.

Field mode coding uses pictures that have already been encoded as fields as reference fields. The reference fields can be any coded I, P, or B fields. The reference fields are stored in a field buffer, which is part of the encoder. An embodiment of the present invention is that a unique reference field number is assigned to each reference field in the field buffer according to its distance from the current picture that is being encoded as two fields. FIG. 7 a and FIG. 7 b show exemplary reference field numbering configurations where the reference fields of the same field parity as the current field are given smaller numbers than are their corresponding second fields according to an embodiment of the present invention. Two fields have the same field parity if they are both top fields or if they are both bottom fields. In the examples of FIG. 7 a and FIG. 7 b, if the first field of the current picture that is to be encoded is a top field, then the first fields of the reference pictures are top fields as well. The second fields would then be bottom fields. The first fields can also be all bottom fields and the second fields can all be top fields.

As shown in FIG. 7 a, a current picture that is to be encoded as a field (700) has a number of reference fields (0-10) in the field buffer (701). The dotted lines labeled f1 are first fields and the dotted lines labeled f2 are second fields. The corresponding frames to the fields are also shown in FIG. 7 a and are represented by solid lines. As shown in FIG. 7 a, if the current field (700) is the first field of the picture that is to be encoded, the first field of the first picture in the field buffer (701) is assigned the number 0, while the second field of the first picture in the field buffer (701) is assigned the number 1. The reference field numbers increase the further the reference fields are temporally from the current field (700). The first fields of the pictures in the field buffer have lower reference numbers than do their corresponding second fields.

FIG. 7 b shows an exemplary reference field numbering configuration where the current field (702) is the second field of the picture that is to be encoded as two fields. The dotted lines labeled f1 are first fields and the dotted lines labeled f2 are second fields. The first field of the current picture has already been coded. As shown in FIG. 7 b, because the current field (702) is a second field, the second field of the first picture in the field buffer (701) is assigned the number 0. The first coded field of the current picture is assigned the number 0. The reference field numbers increase the further the reference fields are temporally from the current field (702). The second fields of the pictures in the field buffer have lower reference numbers than do their corresponding first fields.

FIG. 8 shows an alternate reference field numbering configuration in the field buffer according to an embodiment of the present invention. In this configuration, no favoring is given to fields of the same field parity as the current field. For example, as shown in FIG. 8, the current field (800) is a first field. The most recently coded field of the most recently coded picture in the field buffer is assigned the reference number 0. The reference field numbers increase the further the reference fields are temporally from the current field (800), regardless of their field parity.

According to another embodiment of the present invention, if field coding is selected by the encoder for a particular P picture, the encoder can use the first field that is encoded as a reference field for the encoding of the second field. If the picture is a B picture, the first field that is encoded can be used as one of the two reference fields for the encoding of the second field.

For adaptive bi-prediction (ABP), the two reference pictures can be coded in field mode. In this case, the temporal distances used in calculating the scaled motion vectors are in field interval. In ABP coding, both the reference pictures are in the same direction.

In the temporal prediction with motion compensation algorithm, sub-pel interpolation is performed on each of the pixels in a picture that is encoded in field mode. Padding can also be applied to reference pictures encoded in field mode by repeating the pixels on the field boundaries. Padding is sometimes desirable in the temporal prediction with motion compensation algorithm. Loop filtering, or de-blocking schemes, can be applied to field blocks to account for pixel value discontinuities at the edges of adjacent blocks.

According to another embodiment of the present invention, a macroblock in a P picture can be skipped in AFF coding. If a macroblock is skipped, its data is not transmitted in the encoding of the picture. A skipped macroblock in a P picture is reconstructed by copying the co-located macroblock with motion compensation in the most recently coded I or P reference field of the same field parity. Another embodiment is that the skipped macroblock in the P picture is reconstructed by copying the co-located macroblock in the most recently coded reference field, which can be of a different field parity.

Another embodiment of the present invention is direct mode coding for B pictures. In direct mode coding, the forward and backward motion vectors for the macroblocks in a B picture are derived from the motion vectors used in the corresponding, or co-located macroblocks of a backward reference picture. Co-located macroblocks in two pictures occupy the same geometric position in both of the pictures. The backward reference picture is sometimes referred to as a forward reference picture, even though according to an embodiment of the present invention, the backward reference picture is not necessarily temporally ahead of the current picture that is being encoded.

Direct mode coding is advantageous over other methods of coding because a macroblock can have up to 16 motion vectors and up to 4 reference frames in inter mode coding. Inter mode coding codes a macroblock using temporal prediction with motion compensation. If a macroblock is coded using inter coding, the MPEG-4 Part 10 AVC/H.264 standard allows each of the six smaller block sizes of FIGS. 3 a-f (16 by 8 pixels, 8 by 16 pixels, 8 by 8 pixels, 8 by 4 pixels, 4 by 8 pixels, and 4 by 4 pixels) to have its own motion vector. A block size of 16 by 16 pixels can also have its own motion vector. The MPEG-4 Part 10 AVC/H.264 standard also allows block sizes of 16 by 16 pixels, 16 by 8 pixels, 8 by 16 pixels, and 8 by 8 pixels to have its own reference frame. Thus, a macroblock can have up to 16 motion vectors and up to 4 reference frames. With so many potential motion vectors, it is advantageous to derive the motion vectors of a macroblock that is to be encoded from motion vectors of the backward reference picture's co-located macroblock that are already calculated. In direct mode coding, the forward and backward motion vectors of a macroblock that is to be encoded are computed as the scaled versions of the forward motion vectors of the co-located macroblock in the backward reference picture.

In AFF coding at the picture level, a B picture and its backward reference picture can each be coded in frame mode or in field mode. Hence, in terms of frame and field coding modes, there can be four different combinations for a pair of macroblocks in the B picture and its co-located macroblock of the backward reference picture. In case 1, both the current macroblock and its co-located macroblock are in frame mode. In case 2, both the current macroblock and its co-located macroblock are in field mode. In case 3, the current macroblock is in field mode and its co-located macroblock is in frame mode. Finally, in case 4, the current macroblock is in frame mode and its co-located macroblock is in field mode. The method of direct mode motion vector calculation for the macroblocks that are to be encoded is different in each of the four cases. The four methods of direct motion vector calculation for macroblocks in a B picture will be described in detail below.

The method of direct mode vector calculation in case 1 will be described in connection with FIG. 9. As shown in FIG. 9, a current B picture (900) is to be encoded in frame mode using a backward reference picture (901) that has been encoded in frame mode and a forward reference picture (902) as its reference pictures. Frames in FIG. 9 are represented with solid vertical lines and their corresponding fields, f1 and f2, are represented with dashed vertical lines. According to an embodiment of the present invention, the backward reference picture (901) can be an I, P, or B picture that has been encoded in frame mode. Similarly, the forward reference picture (902) can also be an encoded I, P, or B picture.

As shown in FIG. 9, there is a block (903) in the current B picture (900) and its co-located block (904) in the backward reference picture (901). The block (903) and the co-located block (904) have equal pixel dimensions. These dimensions can be 16 by 16 pixels, 16 by 8 pixels, 8 by 16 pixels, 8 by 8 pixels, 8 by 4 pixels, 4 by 8 pixels, or 4 by 4 pixels. According to an embodiment of the present invention, the encoder derives two motion vectors for the block (903) in the current B picture (900) that are used in the temporal prediction with motion compensation algorithm. One of the motion vectors, MV_(F), points to the forward reference picture (902) that has been encoded in frame mode. The other motion vector, MV_(B), points to the backward reference picture (601) that has been encoded in frame mode. The two motion vectors are calculated by: MV _(F) =TR _(B) ·MV/TR _(D) MV _(B)=(TR _(B) −TR _(D))·MV/TR _(D)  (Eqs. 1 and 2)

In Eqs. 1 and 2, TR_(B) is the temporal distance, approximation of the temporal distance, proportional distance to the temporal distance, or proportional approximation to the approximation of the temporal distance between the current B picture (900) that is to be encoded in frame mode and the forward reference picture (602) that is encoded in frame mode. TR_(D) is the temporal distance, approximation of the temporal distance, proportional distance to the temporal distance, or proportional approximation to the approximation of the temporal distance between the forward (602) and backward reference pictures (601) that have been encoded in frame mode. A preferable method of calculating the temporal distances between reference pictures will be explained below. MV is the motion vector that has already been calculated for the co-located block (904) in the backward reference picture (901) and points to the forward reference picture (902) that has been encoded in frame mode.

The method of direct mode vector calculation in case 2 will be described in connection with FIG. 10 and FIG. 11. As shown in FIG. 10 and FIG. 11, a current B picture (900) is to be encoded in field mode using a backward reference picture (901) that has been encoded in field mode and a forward reference picture (902) as its reference pictures. Frames in FIG. 10 and FIG. 11 are represented with solid vertical lines and their corresponding fields, f1 and f2, are represented with dashed vertical lines. According to an embodiment of the present invention, the backward reference picture (901) can be an I, P, or B picture that has been encoded in frame mode. Similarly, the forward reference picture (902) can also be an encoded I, P, or B picture.

As shown in FIG. 10, there is a block (905) in the first field of the current B picture (900). Its motion vectors are derived from the forward motion vector, MV₁ of its co-located block (906) in the backward reference picture (901). According to an embodiment shown in FIG. 10, the co-located block (906) is in a field of the same parity as is the block (905) in the current B picture (900). The block (905) and the co-located block (906) have equal pixel dimensions. These dimensions can be 16 by 16 pixels, 16 by 8 pixels, 8 by 16 pixels, 8 by 8 pixels, 8 by 4 pixels, 4 by 8 pixels, or 4 by 4 pixels.

According to an embodiment of the present invention, the encoder derives two motion vectors for the block (905) in the current B picture (900) that are used in the temporal prediction with motion compensation algorithm. One of the motion vectors, MV_(F,1), points to the field in the forward reference picture (902) to which MV₁ points. The other motion vector, MV_(B,1), points to the field of the co-located block (906) in the backward reference picture (901). The two motion vectors are calculated by: MV _(F,i) =TR _(B,i) ·MV _(i) /TR _(D,i) MV _(B,i)=(TR _(B,i) −TR _(D,i))·MV _(i) /TR _(D,i)  (Eqs. 3 and 4)

In Eqs. 3 and 4, the subscript, i, is the field index. The first field has a field index of 1 and the second field's field index is 2. Thus, in the exemplary scenario of FIG. 10, the field index is 1 because the first field is being encoded. MV₁ is the forward motion vector of the co-located macroblock in field i of the backward reference picture (901). TR_(B,i) is the temporal distance, approximation of the temporal distance, proportional distance to the temporal distance, or proportional approximation to the approximation of the temporal distance between the i-th field of the current B picture (900) and the reference field pointed to by MV_(i). TR_(D,i) is the temporal distance, approximation of the temporal distance, proportional distance to the temporal distance, or proportional approximation to the approximation of the temporal distance between the i-th field of the backward reference picture (901) and the reference field pointed to by MV_(i).

As shown in FIG. 10, there is another block (907) in the second field of the current B picture (900). It has a co-located block (908) in the second field of the backward reference picture (901). If the forward motion vector of the co-located block (908) points to a previously coded field in any picture other than its own picture, the calculation of the forward and backward motion vectors follow Eqs. 3 and 4, with the field index equal to 2.

However, according to an embodiment of the present invention, the forward motion vector of the co-located block (908) in the second field of the backward reference picture (901) can also point to the first field of the same backward reference picture (901), as shown in FIG. 11. FIG. 11 shows that the co-located block (908) has a forward motion vector, MV₂, that points to the first field of the backward reference picture (901). In this case, the two motion vectors for the current block (907) are calculated as follows: MV _(F,2) =−TR _(B,2) ·MV ₂ /TR _(D,2) MV _(B,2)=−(TR _(B,2) +TR _(D,2))·MV ₂ /TR _(D,2)

In Eqs. 5 and 6, TR_(B,2) is the temporal distance, approximation of the temporal distance, proportional distance to the temporal distance, or proportional approximation to the approximation of the temporal distance between the second field of the current B picture (900) and the reference field pointed to by MV₂. TR_(D,2) is the temporal distance, approximation of the temporal distance, proportional distance to the temporal distance, or proportional approximation to the approximation of the temporal distance between the second field of the backward reference picture (901) and the reference field pointed to by MV₂. In this case, as shown in FIG. 11, both motion vectors point in the backward direction.

The method of direct mode vector calculation in case 3 will be described in connection with FIG. 12. As shown in FIG. 12, a current B picture (900) is to be encoded in field mode using a backward reference picture (901) that has been encoded in frame mode and a forward reference picture (902) as its reference pictures. Frames in FIG. 12 are represented with solid vertical lines and their corresponding fields, f1 and f2, are represented with dashed vertical lines. According to an embodiment of the present invention, the backward reference picture (901) can be an I, P, or B picture that has been encoded in frame mode. Similarly, the forward reference picture (902) can also be an encoded I, P, or B picture.

As shown in FIG. 12, there is a block (905) in the first field of the current B picture (900). According to an embodiment shown in FIG. 12, the co-located block (904) is coded in frame mode. According to an embodiment of the present invention, the encoder derives two motion vectors for the block (905) in the current B picture (900) that are used in the temporal prediction with motion compensation algorithm. As shown in FIG. 12, one of the motion vectors, MV_(F,1), points to the field in the forward reference picture (902) that has the same parity as the current block's (905) field parity. In the example of FIG. 12, the current block (905) is in the first field of the current B picture (900). The other motion vector, MV_(B,1), points to the field of similar parity in the backward reference picture (901). The two motion vectors are calculated by: MV _(F,i) =TR _(B,i) ·MV/TR _(D) MV _(B,i)=(TR _(B,i) −TR _(D))·MV/TR _(D)  (Eqs. 7 and 8)

In Eqs. 7 and 8, MV is derived by dividing the frame-based forward motion vector of the co-located block (904) by two in the vertical direction. This compensates for the fact that the co-located block (904) is in frame mode while the current block (905) is in field mode. The subscript, i, is the field index. The first field has a field index of 1 and the second field's field index is 2. Thus, in the exemplary scenario of FIG. 12, the field index is 1 because the first field is being encoded. TR_(B,i) is the temporal distance, approximation of the temporal distance, proportional distance to the temporal distance, or proportional approximation to the approximation of the temporal distance between the i-th field of the backward reference picture (901) and the i-th field of the forward reference frame (902). TR_(D) is the temporal distance, approximation of the temporal distance, proportional distance to the temporal distance, or proportional approximation to the approximation of the temporal distance between the i-th field of the current B picture (900) and the frame of the co-located block (904) in the backward reference picture (901). The same equations are used to calculate the motion vectors for the block (907) in the second field of the current B picture (900).

The method of direct mode vector calculation in case 4 will be described in connection with FIG. 13. As shown in FIG. 13, a current B picture (900) is to be encoded in frame mode using a backward reference picture (901) that has been encoded in field mode and a forward reference picture (902) as its reference pictures. Frames in FIG. 13 are represented with solid vertical lines and their corresponding fields, f1 and f2, are represented with dashed vertical lines. According to an embodiment of the present invention, the backward reference picture (901) can be an I, P, or B picture that has been encoded in frame mode. Similarly, the forward reference picture (902) can also be an encoded I, P, or B picture.

As shown in FIG. 13, there is a block (903) in the current B picture (900) that is to be encoded as a frame. Its motion vectors are derived from the forward motion vector, MV₁, of its co-located block (906) in the backward reference picture (901). According to an embodiment of the present invention, the encoder derives two motion vectors for the current block (903) in the current B picture (900) that are used in the temporal prediction with motion compensation algorithm. The two motion vectors are calculated as follows: MV _(F) =TR _(B) ·MV ₁ /TR _(D,1) MV _(B)=(TR _(B) −TR _(D,1))·MV ₁ /TR _(D,1)  (Eqs. 9 and 10)

In Eqs. 9 and 10, MV₁ is derived by doubling the field-based motion vector of the co-located block (906) in the first field of the backward reference picture (901) in the vertical direction. TR_(B) is the temporal distance, approximation of the temporal distance, proportional distance to the temporal distance, or proportional approximation to the approximation of the temporal distance between the reference frame which corresponds with the field in the forward reference picture (902) to which points the forward motion vector of the co-located block (906). In FIG. 13, this motion vector is labeled MV₁. TR_(D,1) is the temporal distance, approximation of the temporal distance, proportional distance to the temporal distance, or proportional approximation to the approximation of the temporal distance between the first field of the backward reference picture (901) and the field in the forward reference picture (902) to which points the forward motion vector of the co-located block (906).

Another embodiment of the present invention extends direct mode coding to P pictures. In AFF coding at the picture level, a P picture and its backward reference picture can be coded in frame mode or in field mode. Hence, in terms of frame and field coding modes, there can be four different combinations for a pair of macroblocks in the P picture and its co-located macroblock of the backward reference picture. In case 1, both the current macroblock and its co-located macroblock are in frame mode. In case 2, both the current macroblock and its co-located macroblock are in field mode. In case 3, the current macroblock is in field mode and its co-located macroblock is in frame mode. Finally, in case 4, the current macroblock is in frame mode and its co-located macroblock is in field mode. Blocks in P pictures only have one motion vector, a forward motion vector. The method of direct mode motion vector calculation for the macroblocks that are to be encoded is different in each of the four cases. The four methods of direct motion vector calculation for macroblocks in a B picture will be described in detail below.

In case 1, both the current P picture and its backward reference picture are encoded in frame mode. The forward reference picture for a block in the current P picture is the same picture used by its co-located block in the backward reference picture. Thus, the forward motion vector, MV_(F), of the current block is the same as the forward motion vector of its co-located block.

In case 2, both the current P picture and its backward reference picture are encoded in field mode. The motion vector in direct mode coding of a block in a field of the current P picture is calculated from the forward motion vector of the co-located block in the field with the same parity in the backward reference picture. The forward motion vector, MV_(F,i), for the block in the i-th field of the current P picture is the same as the forward motion vector of its co-located block in the i-th field of the backward reference picture.

In case 3, the current P picture is in field mode and the backward reference picture is in frame mode. Since the co-located block of a block in one of the fields of the current P picture is frame coded, the forward motion vector of a block in one of the fields of the current P picture is derived by dividing the co-located block's motion vector by two in the vertical direction.

In case 4, the current P picture is in frame mode and the backward reference picture is in field mode. The co-located block in the first field of the backward reference picture is used in calculating the forward motion vector of the block in the current P picture that is in frame mode. The forward motion vector, MV_(F), of a block in the current P picture in frame mode is derived by doubling the field-based motion vector of the co-located block in the first field of the backward reference picture in the vertical direction.

Another embodiment of the present invention is multi-frame interpolative prediction mode (MFIP). MFIP is a general frame interpolative prediction framework. As explained previously, a B picture that is encoded in frame mode or field mode has two reference pictures that are encoded in frame mode or field mode. The two reference pictures can be both forward reference pictures, as shown in FIG. 14. FIG. 14 shows a B picture (140) that is to be encoded that has two reference pictures. One of the reference pictures is a forward reference picture (141) and the other is a backward reference picture (142). As shown in FIG. 14, they are both in the same temporal forward direction. The two reference pictures can also both be in the temporal backward direction, as shown in FIG. 15. In FIG. 15, the B picture (140) has both its forward reference picture (141) and its backward reference picture (142) in the temporal backward direction. FIG. 16 shows another embodiment of the present invention. As shown in FIG. 16, the B picture (140) can have the forward reference picture (141) in the temporal forward direction and the backward reference picture (142) in the temporal backward direction.

In MFIP, a prediction signal is a linear interpolation of motion compensated signals. The prediction signal (pred) in MPIF of a B picture is calculated as: pred=w ₁ ref ₁ +w ₂ ref ₂ +d  (Eq. 11)

In Eq. 11, the variables ref₁ and ref₂ are the two reference pictures. The variables w₁ and w₂ are weighting factors. The variable d is set to zero by default. The linear interpolation coefficients w₁, w₂, d can be determined explicitly for each macroblock. The reference picture, ref₁, is the reference picture closer to the B picture in terms of temporal distance if both ref₁ and ref₂ are forward or backward reference pictures. For bi-directional reference pictures, ref₁ and ref₂ are the forward and backward reference pictures, respectively.

Both motion vectors of a MFIP macroblock are coded relative to each other. The motion vector of ref₂, MV₂, is generated by adding an offset DMV to the scaled motion vector of ref₁, MV₁ using the following equation: $\begin{matrix} {{MV}_{2} = {\frac{{TR}_{2} \times {MV}_{1}}{{TR}_{1}} + {DMV}}} & \left( {{Eq}.\quad 12} \right) \end{matrix}$

In Eq. 12, the variable DMV is the data motion vector and is an offset. The variables TR₁ and TR₂ are the temporal distances, approximation of the temporal distance, proportional distance to the temporal distance, or proportional approximation to the approximation of the temporal distance between the current picture and the nearest reference picture, ref₁, and the farthest reference picture, ref₂, respectively.

In picture level AFF, a B picture can be can be coded as one B frame picture or two B field pictures. Rules for handling MFIP in field mode, with both the current B picture that is to be encoded and its reference pictures in field structure are given below:

Eq. 11 is used to generate prediction signal. However, ref₁ and ref₂ are the fields that are indexed by reference field numbers, ref_idx_fwd and ref_idx_bwd. The fields ref₁ and ref₂ can be either top or bottom fields. The default weighting factors, w₁ and w₂, are (0.5, 0.5, 0) and (2, −1, 0), respectively.

Equation 12 is used to generate MV₂. Since both reference pictures are in field structure, TR₁ and TR₂ are determined based on the temporal distances between the reference and the current fields.

Code number for reference field number, ref_idx_fwd and ref_idx_bwd, in MFIP mode follow the know and normal convention for field picture.

The temporal distance between pictures in AFF coding can be calculated using a variable, temporal reference (TR) or by counting the picture numbers and calculating their differences. An embodiment of the present invention is that TR is incremented by 1 per field, and wrapped by a constant (for example, 256) for picture level AFF. TR is in field interval. Let n be the frame index or the frame number. The variable n is incremented by 1 per frame. If a frame with frame index n is encoded in frame mode, the TR of this frame is 2n. If a frame with frame index n is encoded in field mode, the TR of the first field of this frame is 2n and the TR of the second field is 2n+1.

The preceding description has been presented only to illustrate and describe embodiments of invention. It is not intended to be exhaustive or to limit the invention to any precise form disclosed. Many modifications and variations are possible in light of the above teaching.

The foregoing embodiments were chosen and described in order to illustrate principles of the invention and some practical applications. The preceding description enables others skilled in the art to utilize the invention in various embodiments and with various modifications as are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the following claims. 

1-7. (canceled)
 8. A method of coding an image sequence having a plurality of pictures, comprising: selectively coding at least one of said plurality of pictures in a frame coding mode; and selectively coding another picture of at least one of said plurality of pictures in a field coding mode, wherein the steps of coding in said frame coding mode and coding in said field coding mode each include either encoding or decoding, wherein a current picture in said frame coding mode has at least one reference frame, where each of said at least one reference frame is assigned a unique reference frame number, and wherein a current field of a current picture in said field coding mode has at least one reference field, where each of said at least one reference field is assigned a unique reference field number.
 9. The method of claim 8, wherein said unique reference frame number assigned to said at least one said reference frame is based upon a temporal distance between said at least one reference frame and said current picture that is being coded.
 10. The method of claim 8, wherein said current picture has multiple forward and backward reference pictures, where each of said reference pictures is assigned a unique reference number.
 11. The method of claim 8, wherein said current field has multiple forward and backward reference fields, where each of said reference fields is assigned a unique reference number.
 12. The method of claim 8, wherein said unique reference field number assigned to said at least one reference field is based upon a temporal distance between said at least one reference field and said current field and a field parity of said current field, wherein said current field is either a first field or a second field of said current picture.
 13. The method of claim 12, wherein given said current field, a reference field that is of a same field parity as that of said current field is given a smaller unique reference field number relative to its corresponding other reference field of a same reference picture.
 14. The method of claim 13, wherein if a first field of said current picture is to be coded, then a first field of a first reference picture is assigned a reference field number 0, while a second field of said first reference picture is assigned a reference field number
 1. 15. The method of claim 13, wherein if a second field of said current picture is to be coded, then a second field of a first reference picture is assigned a reference field number 0, while a first field of said current picture that has been coded as a reference field is assigned a reference field number
 1. 16. The method of claim 8, wherein said unique reference field number assigned to said reference field is based upon a temporal distance between said reference field and said current field, where said current field is a first field or a second field of said current picture.
 17. The method of claim 16, wherein a reference field that is temporally closest to said current field is assigned a reference field number 0, while a reference field that is temporally next closest to said current field is assigned a reference field number
 1. 18. An apparatus for encoding an image sequence having a plurality of pictures, comprising: a coding unit configured to code at least one picture of said plurality of pictures in a frame coding mode; and at least one picture of said plurality of pictures in a field coding mode, wherein said coding unit is configured to perform either one of encoding or decoding or both encoding and decoding, wherein a current picture in said frame coding mode has at least one reference frame, where each of said at least one reference frame is assigned a unique reference frame number, and wherein said current field in said field coding mode has at least one reference field, where each of said at least one reference field is assigned a unique reference field number.
 19. The apparatus of claim 18, wherein said unique reference frame number assigned to said at least one said reference frame is based upon a temporal distance between said at least one reference frame and said current picture that is being coded.
 20. The apparatus of claim 18, wherein said current picture has multiple forward and backward reference pictures, where each of said reference pictures is assigned a unique reference number.
 21. The apparatus of claim 18, wherein said current field has multiple forward and backward reference fields, where each of said reference fields is assigned a unique reference number.
 22. The apparatus of claim 18, wherein said unique reference field number assigned to said at least one reference field is based upon a temporal distance between said at least one reference field and said current field and a field parity of said current field, wherein said current field is either a first field or a second field of said current picture.
 23. The apparatus of claim 22, wherein given said current field, a reference field that is of a same field parity as that of said current field is given a smaller unique reference field number relative to its corresponding other reference field of a same reference picture.
 24. The apparatus of claim 23, wherein if a first field of said current picture is to be coded, then a first field of a first reference picture is assigned a reference field number 0, while a second field of said first reference picture is assigned a reference field number
 1. 25. The apparatus of claim 23, wherein if said second field of said current picture is to be coded, then a second field of a first reference picture is assigned a reference field number 0, while a first field of said current picture that has been coded as a reference field is assigned a reference field number
 1. 26. The apparatus of claim 18, wherein said unique reference field number assigned to said reference field is based upon a temporal distance between said reference field and said current field, where said current field is a first field or a second field of said current picture.
 27. The apparatus of claim 26, wherein a reference field that is temporally closest to said current field is assigned a reference field number 0, while a reference field that is temporally next closest to said current field is assigned a reference field number
 1. 28. A computer-readable medium having stored thereon a plurality of instructions, the plurality of instructions including instructions which, when executed by a processor, cause the processor to perform a method of coding an image sequence having a plurality of pictures, comprising of: selectively coding at least one of said plurality of pictures in a frame coding mode; and selectively coding at least one of said plurality of pictures in a field coding mode, wherein the steps of coding in said frame coding mode and coding in said field coding mode each include either encoding or decoding, wherein a current picture in said frame coding mode has at least one reference frame, where each of said at least one reference frame is assigned a unique reference frame number, and wherein a current field in said field coding mode has at least one reference field, where each of said at least one reference field is assigned a unique reference field number.
 29. The computer readable medium of claim 28, wherein said unique reference frame number assigned to said at least one said reference frame is based upon a temporal distance between said at least one reference frame and said current picture that is being coded.
 30. The computer readable medium of claim 28, wherein said current picture has multiple forward and backward reference pictures, where each of said reference pictures is assigned a unique reference number.
 31. The computer readable medium of claim 28, wherein said current field has multiple forward and backward reference fields, where each of said reference fields is assigned a unique reference number.
 32. The computer readable medium of claim 28, wherein said unique reference field number assigned to said at least one reference field is based upon a temporal distance between said at least one reference field and said current field and a field parity of said current field, wherein said current field is either a first field or a second field of said current picture.
 33. The computer readable medium of claim 32, wherein given said current field, a reference field that is of a same field parity as that of said current field is given a smaller unique reference field number relative to its corresponding other reference field of a same reference picture.
 34. The computer readable medium of claim 33, wherein if a first field of said current picture is to be coded, then a first field of a first reference picture is assigned a reference field number 0, while a second field of said first reference picture is assigned a reference field number
 1. 34. The computer readable medium of claim 33, wherein if a second field of said current picture is to be coded, then a second field of a first reference picture is assigned a reference field number 0, while a first field of said current picture that has been coded as a reference field is assigned a reference field number
 1. 35. The computer readable medium of claim 28, wherein said unique reference field number assigned to said reference field is based upon a temporal distance between said reference field and said current field, where said current field is a first field or a second field of said current picture.
 36. The computer readable medium of claim 35, wherein a reference field that is temporally closest to said current field is assigned a reference field number 0, while a reference field that is temporally next closest to said current field is assigned a reference field number
 1. 